using System;
using Cysharp.Threading.Tasks;
using MoonFramework.Scripts.Event;
using Tool.Name;

namespace MoonFramework.Buff
{
    public class DisarmBuff : BaseBuff
    {
        public override void Enter()
        {
            base.Enter();
            Disarm().Forget();
        }

        private async UniTaskVoid Disarm()
        {
            EventCenter.Instance.Callback<string, bool>(EventName.UpdateBuff, nameof(DisarmBuff), true);  //ui面板通讯，连接面板层和逻辑层
            await UniTask.Delay(TimeSpan.FromSeconds(BuffTime));
            EventCenter.Instance.Callback<string, bool>(EventName.UpdateBuff, nameof(DisarmBuff), false); //通知面板层buff消失
            Exit();
        }
    }
}